<!DOCTYPE html>
<script src="../../resources/gc.js"></script>
<script src="../../resources/js-test.js"></script>
<script>

description('Tests that we do not hold on to any nodes');

jsTestIsAsync = true;

function numberOfLiveNodes() {
    return window.internals && internals.numberOfLiveNodes && internals.numberOfLiveNodes();
}

var afterCount;
var beforeCount;

asyncGC(function() {
    beforeCount = numberOfLiveNodes();
    var f = document.createElement('form');
    var i = f.appendChild(document.createElement('input'));
    i.setAttribute('onclick', '');
    f.removeChild(i);
    f = null;
    i = null;
    asyncGC(function() {
        afterCount = numberOfLiveNodes();
        shouldBe('afterCount - beforeCount', '0');
        finishJSTest();
    });
});


</script>
